package com.blogspot.mkorwel.jaas;

import java.io.Serializable;
import java.security.Principal;

/**
 * 
 * @author mkorwel
 *
 */
public class MyPrincipal implements Principal, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1933073722894960007L;
	private final String name;

	public MyPrincipal(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public boolean equals(Object o) {
		if (o == null)
			return false;

		if (this == o)
			return true;

		if (!(o instanceof MyPrincipal))
			return false;
		MyPrincipal that = (MyPrincipal) o;

		if (this.getName().equals(that.getName()))
			return true;
		return false;
	}

	public int hashCode() {
		return name.hashCode();
	}
}
